var surl = location.pathname
var bpc = true //是否是pc端
var jsonip=""
var num=1
//字符串替换
String.format = function () {
  var s = arguments[0];
  for (var i = 0; i < arguments.length - 1; i++) {
    var reg = new RegExp("\\{" + i + "\\}", "gm");
    s = s.replace(reg, arguments[i + 1]);
  }
  return s;
}

function getQueryString(name) {
  var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
  var r = window.location.search.substr(1).match(reg);
  if (r != null) {
      return unescape(r[2]);
  }
  return null;
}
// 检查图片路径是否有效
function checkImgExists(imgurl) {
  return new Promise(function (resolve, reject) {
    var ImgObj = new Image();
    ImgObj.src = imgurl;
    ImgObj.onload = function (res) {
      resolve(res);
    }
    ImgObj.onerror = function (err) {
      reject(err)
    }
  })
}

var slideBoxs = [{
    'c1': "http://www.meixinenv.com",
    "c2": "美心官网banner",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/ba01.jpg",
    "c4": "智能投口系列产品"
  },
  // {
  //   'c1': "http://www.meixinenv.com",
  //   "c2": "美心官网banner",
  //   "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/ba02.jpg",
  //   "c4": "装配式垃圾厢房"
  // },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "美心官网banner",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/ba03.jpg",
    "c4": "AI监管系统"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "美心官网banner",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/ba04.jpg",
    "c4": "投放点改造升级"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "美心官网banner",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/ba05.jpg",
    "c4": "移动垃圾收集车"
  }
]

var nav_d_ol = [{
    'c1': "http://www.meixinenv.com",
    "c2": "产品系列",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/nav_d_1.png",
    "c4": "智能投口系列产品"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "产品系列",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/nav_d_2.png",
    "c4": "装配式垃圾厢房"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "产品系列",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/nav_d_3.png",
    "c4": "AI监管系统"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "产品系列",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/nav_d_4.png",
    "c4": "投放点改造升级"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "产品系列",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/nav_d_5.png",
    "c4": "移动垃圾收集车"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "产品系列",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/nav_d_6.png",
    "c4": "沪尚回收服务点"
  }
]
var mxcp3ds = [{
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cp1.png",
    "c4": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cps1.png",
    "c5": "智能货架"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cp2.png",
    "c4": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cps1.png",
    "c5": "1"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cp3.png",
    "c4": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cps1.png",
    "c5": "1"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cp4.png",
    "c4": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cps1.png",
    "c5": "智能喷雾"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cp5.png",
    "c4": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cps1.png",
    "c5": "1"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cp6.png",
    "c4": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cps1.png",
    "c5": "方便回收，实时定位"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cp7.png",
    "c4": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cps1.png",
    "c5": "方便回收，实时定位"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cp8.png",
    "c4": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cps1.png",
    "c5": "方便回收，实时定位"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cp9.png",
    "c4": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/cps1.png",
    "c5": "蓝牙链接，实时称重"
  }
]

var mxcps = [{
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/small01.png",
    "c4": "积分兑换柜",
    "c5": "智能货架"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/small02.png",
    "c4": "移动称重",
    "c5": "1"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/small03.png",
    "c4": "自助打印",
    "c5": "1"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/small04.png",
    "c4": "智能喷雾除臭",
    "c5": "智能喷雾"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/small05.png",
    "c4": "移动智能设备",
    "c5": "1"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/small06.png",
    "c4": "移动回收车",
    "c5": "方便回收，实时定位"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "明星产品",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/small07.png",
    "c4": "蓝牙智能称",
    "c5": "蓝牙链接，实时称重"
  }
]
var jpdws = [{
    'c1': "http://www.meixinenv.com",
    "c2": "精品点位",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/3jpdw1.jpg",
    "c4": "智能投口系列产品"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "精品点位",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/3jpdw2.jpg",
    "c4": "装配式垃圾厢房"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "精品点位",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/3jpdw3.jpg",
    "c4": "AI监管系统"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "精品点位",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/3jpdw4.jpg",
    "c4": "投放点改造升级"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "精品点位",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/3jpdw5.jpg",
    "c4": "移动垃圾收集车"
  }
]
//企业文化
var enterpriseCultures = [{
    'c1': "http://www.meixinenv.com",
    "c2": "愿景",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/culture1.png",
    "c4": "2028年-2058年提前实现双碳目标"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "使命",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/culture2.png",
    "c4": "低碳环保"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "价值观",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/culture3.png",
    "c4": "已用户休验为中心"
  },
  {
    'c1': "http://www.meixinenv.com",
    "c2": "企业精神",
    "c3": "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/culture4.png",
    "c4": "以贡献者为荣"
  }
]

//资质证书
var mxcredentials = [{
    'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/zizhi%20(1).png"
  },
  {
    'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/zizhi%20(2).png"
  },
  {
    'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/zizhi%20(3).png"
  },
  {
    'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/zizhi%20(4).png"
  },
  {
    'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/zizhi%20(5).png"
  },
  {
    'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/zizhi%20(6).png"
  },
  {
    'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/zizhi%20(7).png"
  }
  // ,{
  //   'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/book1.png"
  // },
  // {
  //   'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/book2.png"
  // },
  // {
  //   'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/book3.png"
  // },
  // {
  //   'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/book4.png"
  // },
  // {
  //   'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/book5.png"
  // },
  // {
  //   'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/book6.jpg"
  // },
  // {
  //   'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/book7.jpg"
  // },
  // {
  //   'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/book8.jpg"
  // },
  // {
  //   'c1': "https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/book9.jpg"
  // }
]
var index = function () {
  console.log("url", surl)

  //获取
  const url = window.location.href;
  const path = 'p'
  var paramValue = "0"
  try {
    paramValue = url.match(new RegExp('[?&]' + path + '=([^&#]*)'))[1];
  } catch (e) {

  }
  console.log('paramValue', paramValue);

  if (surl == '/mx/' || surl == '/mx/index.html') {
    //banner
    if (true) {
      var htmlheard = ""
      for (var i in slideBoxs) {
        var t1 = slideBoxs[i];
        var str1 = ""
        str1 = "<li class=\"slideBox_li \" target=\"_blank\"  style=\"width: 1144px; float: left; display: block;\"> <a class=\"banner_a\" href=\"javascript:void(0)\" rel=\"nofollow\">" +
          " <img class=\"banner_img\" sizes=\"(min-widht: 1px) 100vw\" alt=\"美心官网banner\" src=\"{2}\" draggable=\"false\" style=\"opacity: 1;\"> </a> </li> ";
        htmlheard += String.format(str1, t1.c1, t1.c2, t1.c3, t1.c4);
      }
      $('#slideBox_bgUl').empty();
      $('#slideBox_bgUl').append(htmlheard);
      $('#slideBox_bgUl').trigger("create");
    }
  }
  //首页
  if (paramValue == '0') {
    get1()
  }
  //企业文化
  if (paramValue == '2') {
    get2()
  }
  //新闻动态
  if(paramValue=='5'){
    get5()
  }
}

//获取用户访问ip地址。
function getIP(json) {
    jsonip=json.ip
}
//首页展示。
function get1() {
  // document.getElementById("yewu-conext").style.display = "block";
  // document.getElementById("product-star").style.display = "block";
  // document.getElementById("product-3D").style.display = "block";
  // document.getElementById("product-list").style.display = "block";
  // document.getElementById("jpdw-titile").style.display = "block";
  // document.getElementById("jpdw-context").style.display = "block";
  // document.getElementById("mx-news").style.display = "block";
  // document.getElementById("mx-news-context").style.display = "block";

  document.getElementById("mx-profile").style.display = "none";
  document.getElementById("mx-culture").style.display = "none";
  document.getElementById("mx-credential").style.display = "none";

  document.getElementById("mx-news-detail").style.display = "none";

  
  //首页轮播图
  if (true) {
    var htmlheard = ""
    var htmlmobile = ""
    for (var i in nav_d_ol) {
      var t1 = nav_d_ol[i];
      var str1 = ""
      str1 = "<li class=\"websiteCategory_li\"> <a href=\"{0}\" class=\"websiteCategory_a\" rel=\"nofollow\" target=\"_blank\"> " +
        "<div class=\"m-pic\">" +
        " <img class=\"websiteCategory_img\" alt=\"{1}\" src=\"{2}\">" +
        "</div> <p class=\"websiteCategory_name\">{3}</p> </a> </li> ";
      htmlheard += String.format(str1, t1.c1, t1.c2, t1.c3, t1.c4);
      var str2 = ""
      str2 = "<li class=\"websiteCategory_mobile_li\"> <a href=\"{0}\" class=\"websiteCategory_mobile_a\" target=\"_blank\">" +
        "          <div class=\"m-pic\"> " +
        "         <img class=\"websiteCategory_mobile_img\" alt=\"{1}\" src=\"{2}\">" +
        "      </div> <p class=\"websiteCategory_mobile_name \" style='word-wrap: break-word;white-space: pre-line;'>{3}</p> </a> </li>";
      htmlmobile += String.format(str2, t1.c1, t1.c2, t1.c3, t1.c4);
    }
    $('#nav_d_ol').empty();
    $('#nav_d_ol').append(htmlheard);
    $('#nav_d_ol').trigger("create");
    $('#nav_d_mobile_ol').empty();
    $('#nav_d_mobile_ol').append(htmlmobile);
    $('#nav_d_mobile_ol').trigger("create");
  }
  //明星产品3d图片
  if (true) {
    var htmlheard = ""
    for (var i in mxcp3ds) {
      var t1 = mxcp3ds[i];
      var str1 = ""
      //{'c1':"http://www.meixinenv.com","c2":"明星产品","c3":"https://meixinpicture.oss-cn-shanghai.aliyuncs.com/web/small01.png","c4":"积分兑换柜","c5":"智能货架"}
      str1 = "<div class=\"slide websiteStarProduct_div bx-clone\"" +
        "   data-img=\"{2}\"" +
        "  data-a=\"{0}\"" +
        "   style=\"float: none; list-style: none; position: relative; width: 100px; margin-bottom: 30px;\">" +
        "   <img class=\"websiteStarProduct_img\" alt=\"{1}\"" +
        "     src=\"{3}\">" +
        " </div>";
      htmlheard += String.format(str1, t1.c1, t1.c2, t1.c3, t1.c4, t1.c5);
    }
    $('#mxcp3ds_div').empty();
    $('#mxcp3ds_div').append(htmlheard);
    $('#mxcp3ds_div').trigger("create");
  }
  //明星产品图片
  if (true) {
    var htmlheard = ""

    for (var i in mxcps) {
      var t1 = mxcps[i];
      var str1 = ""
      if (bpc) {
        str1 = "<div class=\"slide-bottom-item swiper-slide websiteProduct_div \" style=\"width: 217.667px;\"> " +
          "<div class=\"item_box\"> " +
          "<a href=\"{0}\" class=\"m-pic websiteProduct_a\" rel=\"nofollow\" target=\"_blank\"> " +
          "<img class=\"websiteProduct_img\" alt=\"{1}\" src=\"{2}\"> </a> " +
          " <div class=\"bottom-item-txt\"> " +
          " <h4 class=\"websiteProduct_name\">{3}</h4> " +
          "<p class=\"websiteProduct_introduce\">{4}</p> " +
          " </div> " +
          " </div> " +
          "</div>";
      } else {
        str1 = "<div class=\"slide-bottom-item swiper-slide websiteProduct_div \" style=\"width: 200px;height: 280px;\"> " +
          "<div class=\"item_box\"> " +
          "<a href=\"{0}\" class=\"m-pic websiteProduct_a\" rel=\"nofollow\" target=\"_blank\"> " +
          "<img class=\"websiteProduct_img\" alt=\"{1}\" src=\"{2}\"> </a> " +
          " <div class=\"bottom-item-txt\"> " +
          " <h4 class=\"websiteProduct_name\">{3}</h4> " +
          "<p class=\"websiteProduct_introduce\">{4}</p> " +
          " </div> " +
          " </div> " +
          "</div>";
      }

      htmlheard += String.format(str1, t1.c1, t1.c2, t1.c3, t1.c4, t1.c5);
    }
    $('#mxcp_div').empty();
    $('#mxcp_div').append(htmlheard);
    $('#mxcp_div').trigger("create");
  }

  //精品图片
  if (true) {
    var htmlheard = ""
    var htmlmobile = ""
    for (var i in jpdws) {
      var t1 = jpdws[i];
      var str1 = ""
      str1 = "<div class=\"swiper-slide boutiqueSuite_div\"> " +
        "      <a href=\"{0}\" class=\"boutiqueSuite_a  m-pic\" rel=\"nofollow\" target=\"_blank\"> " +
        "<img class=\"boutiqueSuite_img\" alt=\"{1}\" src=\"{2}\"> </a> " +
        "</div> ";
      htmlheard += String.format(str1, t1.c1, t1.c2, t1.c3, t1.c4);
      var str2 = ""

      str2 = "<div class=\"swiper-slide boutiqueSuite_mobile_div swiper-slide-active\" style=\"width: 300px;height: 200px; margin-right: 8px;\"> " +
        "            <a href=\"{0}\" class=\"m-pic boutiqueSuite_mobile_a\" rel=\"nofollow\" target=\"_blank\">" +
        " <img class=\"boutiqueSuite_mobile_img\" alt=\"{1}\" src=\"{2}\"> </a> " +
        "           </div> ";

      htmlmobile += String.format(str2, t1.c1, t1.c2, t1.c3, t1.c4);
    }
    $('#jpdw_div').empty();
    $('#jpdw_div').append(htmlheard);
    $('#jpdw_div').trigger("create");
    $('#jpdw_mobile_div').empty();
    $('#jpdw_mobile_div').append(htmlmobile);
    $('#jpdw_mobile_div').trigger("create");
  }
}

//获取企业内容
function get2() {

  document.getElementById("mx-banner").style.display = "none";

  document.getElementById("yewu-conext").style.display = "none";
  document.getElementById("product-star").style.display = "none";
  document.getElementById("product-3D").style.display = "none";
  document.getElementById("product-list").style.display = "none";
  document.getElementById("jpdw-titile").style.display = "none";
  document.getElementById("jpdw-context").style.display = "none";

  document.getElementById("mx-news").style.display = "none";
  document.getElementById("mx-news-context").style.display = "none";

  // document.getElementById("mx-profile").style.display = "none";
  // document.getElementById("mx-culture").style.display = "none";
  // document.getElementById("mx-credential").style.display = "none";
  document.getElementById("mx-news-detail").style.display = "none";
  //企业文化
  if (true) {
    var htmlheard = ""
    for (var i in enterpriseCultures) {
      var t1 = enterpriseCultures[i];
      var str1 = ""
      str1 = "<div class=\"z-col-4 enterpriseCulture_div\">  <div class=\"z_box_list\"> " +
        "           <div class=\"z_box_list-txt\"> " +
        "          <h3 class=\"enterpriseCulture_name\">{1}</h3>" +
        "        <p class=\"enterpriseCulture_remark\">{3}</p>  " +
        "     </div> " +
        "   <div class=\"m-pic\">" +
        "  <a href=\"#\" onclick=\"return false;\"  class=\"enterpriseCulture_a\" style=\"cursor: default;\" rel=\"nofollow\" target=\"_blank\"> " +
        "  <img class=\"enterpriseCulture_img\" alt=\"{0}\" src=\"{2}\"> </a> " +
        "            </div> " +
        "           </div> " +
        "          </div></div>";
      htmlheard += String.format(str1, t1.c1, t1.c2, t1.c3, t1.c4);
    }
    $('#enterpriseCulture_div').empty();
    $('#enterpriseCulture_div').append(htmlheard);
    $('#enterpriseCulture_div').trigger("create");
  }
  //资质证书
  if (true) {
    var htmlheard = ""
    var htmlmobile = ""
    for (var i in jpdws) {
      var t1 = jpdws[i];
      var str1 = ""
      str1 = "<div class=\"swiper-slide boutiqueSuite_div\"> " +
        "      <a href=\"{0}\" class=\"boutiqueSuite_a  m-pic\" rel=\"nofollow\" target=\"_blank\"> " +
        "<img class=\"boutiqueSuite_img\" alt=\"{1}\" src=\"{2}\"> </a> " +
        "</div> ";
      htmlheard += String.format(str1, '', '', t1.c1);
      var str2 = ""

      str2 = "<div class=\"swiper-slide boutiqueSuite_mobile_div swiper-slide-active\" style=\"width: 300px;height: 200px; margin-right: 8px;\"> " +
        "            <a href=\"{0}\" class=\"m-pic boutiqueSuite_mobile_a\" rel=\"nofollow\" target=\"_blank\">" +
        " <img class=\"boutiqueSuite_mobile_img\" alt=\"{1}\" src=\"{2}\"> </a> " +
        "           </div> ";

        htmlheard += String.format(str1, '', '', t1.c1);
    }
    $('#mx-credential-div').empty();
    $('#mx-credential-div').append(htmlheard);
    $('#mx-credential-div').trigger("create");
    $('#mx-credential-mobile-div').empty();
    $('#mx-credential-mobile-div').append(htmlmobile);
    $('#mx-credential-mobile-div').trigger("create");
  }

  if (true) {
    var htmlheard = ""
    for (var i in mxcredentials) {
      var t1 = mxcredentials[i];
      var str1 = ""
      str1 = " <div class=\"swiper-slide\">" +
        " <div class=\"\">" +
        " <img class=\"honor_img\" alt=\"美心\" src=\"{0}\" data-index=\"0\"> " +
        "</div>" +
        "</div>";
      htmlheard += String.format(str1, t1.c1);
    }
    $('#mx-credential-div').empty();
    $('#mx-credential-div').append(htmlheard);
    $('#mx-credential-div').trigger("create");
  }
}

//获取企业内容
function get5() {
  document.getElementById("mx-banner").style.display = "none";

  document.getElementById("yewu-conext").style.display = "none";
  document.getElementById("product-star").style.display = "none";
  document.getElementById("product-3D").style.display = "none";
  document.getElementById("product-list").style.display = "none";
  document.getElementById("jpdw-titile").style.display = "none";
  document.getElementById("jpdw-context").style.display = "none";

  document.getElementById("mx-news").style.display = "none";
  document.getElementById("mx-news-context").style.display = "none";

  document.getElementById("mx-profile").style.display = "none";
  document.getElementById("mx-culture").style.display = "none";
  document.getElementById("mx-credential").style.display = "none";

    //获取
    const url = window.location.href;
    const path = 'c1'
    var paramValue = "36"
    try {
      paramValue = url.match(new RegExp('[?&]' + path + '=([^&#]*)'))[1];
    } catch (e) {
  
    }
  //获取列表内容
  // document.getElementById("mx-news-detail").style.display = "none";
  var rowData ={"startIndex":0,"pageSize":10};
  $.ajax({
      type:"POST",                      //请求类型
      url:"http://uat.meixinhuanbao.com:8899/Home/getNewsproduct",         //URL
      data:JSON.stringify(rowData),  //传递的参数
      contentType:"application/json",
      dataType:"json",                 //返回的数据类型
      success: function (data) {
          console.log(data)
          newsdata=data
          var html='';
          var list=data.list
          for (var i in list) {
              var temp = list[i];
              html+='	<li>'+(num++)+'.<a href="index.html?p=5&c1='+temp.c1+'">'+temp.c2+'</a></li> '
              if (temp.c1==paramValue) {
                 setonpage(temp)
              }

          }
          $('#news-list').empty();
          $('#news-list').append(html);
          $('#news-list').trigger("create");
      },
      error:function(data){
          
      }
  }); 

  // c1=36
  //单页数据

    
}

function setonpage(newsdata){
  
  var htmlheard2 = ""
  var str1 = ""
  str1 = "<h2>{1}</h2>"+
  "<p>"+
  "	<span>{5}</span>"+
  "	<span>浏览量：{6}</span>"+
  "	<label class=\"bdsharebuttonbox\"><font class=\"fl\">分享到 &nbsp;</font>"+
  "		<a href=\"##\" class=\"bds_weixin\" data-cmd=\"weixin\"></a>"+
  "		<a href=\"##\" class=\"bds_tsina\" data-cmd=\"tsina\"></a>"+
  "	</label>"+
  "</p>";
  htmlheard2 += String.format(str1, newsdata.c1,newsdata.c2,newsdata.c3,newsdata.c4,newsdata.c5,newsdata.c6,newsdata.c7);

$('#detail-titile').empty();
$('#detail-titile').append(htmlheard2);
$('#detail-titile').trigger("create");


$('#detail-content').empty();
$('#detail-content').append(newsdata.c5);
$('#detail-content').trigger("create");
}

function end() {
  // 获取页面的高度
  const pageHeight = document.documentElement.scrollHeight;
  // 设置滚动位置到页面底部
  window.scrollTo(0, pageHeight);
}

// 判断是否是PC端
function isPc() {
  var userAgentInfo = navigator.userAgent;
  var agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
  var flag = true;
  for (var i = 0; i < agents.length; i++) {
    if (userAgentInfo.indexOf(agents[i]) > 0) {
      flag = false;
      break;
    }
  }
  return flag;
}
//建立查询函数
getpermission = function () {

  //美心产品
  var dd5 = document.getElementById("mxcp_div")
  // 示例用法
  if (isPc()) {
    bpc = true
    // PC端逻辑
    // alert("PC端逻辑")
    var dd3 = document.getElementById("product-3D")
    // 添加样式类
    dd3.classList.add("ui-draggable-suojin");

    var dd4 = document.getElementById("product-list")
    dd4.classList.add("ui-draggable-suojin");

    dd5.style.height = "50%"
  } else {
    bpc = false
    dd5.style.height = "35%"
    // 手机端逻辑
    // alert("手机端逻辑")
  }
  //获取地理位置
  // setTimeout(function(){
  //   var myCity = new BMap.LocalCity();
  //   myCity.get(function(data){
  //   console.log('area:',data)
  // });
  // }  ,2000);

}

//首页加载内容.必须放在后面
window.onload = getpermission()

$(function () {
  index()
  // setTimeout("index()","2000"); 
  zzcomp()

  var swiper = new Swiper(".mySwiper", {});
})

function zzcomp() {

  if (isPc()) {
    var swiper = new Swiper('.swiper-container-zz', {
      //   slidesPerView: "auto",
      //   slidesPerView: 3,
      //   spaceBetween: 30,
      centeredSlides: true,
      // loop: true,
      //   pagination: {
      //     el: '.swiper-pagination',
      //     clickable: true,
      //   },
      slidesPerView: 2,
      // slidesPerView: "auto",
      spaceBetween: 30,
      pagination: {
        el: ".swiper-pagination",
        clickable: true,
      },
    });
  }else{
    var swiper = new Swiper('.swiper-container-zz', {
      //   slidesPerView: "auto",
      //   slidesPerView: 3,
      //   spaceBetween: 30,
      // centeredSlides: true,
      // loop: true,
      //   pagination: {
      //     el: '.swiper-pagination',
      //     clickable: true,
      //   },
      // slidesPerView: 1,
      // slidesPerView: "auto",
      // spaceBetween: 30,
      // pagination: {
      //   el: ".swiper-pagination",
      //   clickable: true,
      // },
    });
  }
}